curl --request PUT \
--url https://{tenant_domain}/third-party/v1/whatsapp/campaigns/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"agent_id": 123,
"template_name": "<unknown>",
"template_language": "de",
"template_components": [
{}
],
"recipients": [
{
"profile_id": 123,
"name": "<string>",
"phone_number": 4915212345678,
"placeholders": {}
}
],
"start_at": "2023-01-01T12:00:00Z",
"send_from": "00:00:00",
"send_until": "23:59:59",
"assign_bot_id": 123,
"assign_user_id": 123,
"assign_folder_id": 123
}
'import requests
url = "https://{tenant_domain}/third-party/v1/whatsapp/campaigns/{id}"
payload = {
"name": "<string>",
"agent_id": 123,
"template_name": "<unknown>",
"template_language": "de",
"template_components": [{}],
"recipients": [
{
"profile_id": 123,
"name": "<string>",
"phone_number": 4915212345678,
"placeholders": {}
}
],
"start_at": "2023-01-01T12:00:00Z",
"send_from": "00:00:00",
"send_until": "23:59:59",
"assign_bot_id": 123,
"assign_user_id": 123,
"assign_folder_id": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
agent_id: 123,
template_name: '<unknown>',
template_language: 'de',
template_components: [{}],
recipients: [
{
profile_id: 123,
name: '<string>',
phone_number: 4915212345678,
placeholders: {}
}
],
start_at: '2023-01-01T12:00:00Z',
send_from: '00:00:00',
send_until: '23:59:59',
assign_bot_id: 123,
assign_user_id: 123,
assign_folder_id: 123
})
};
fetch('https://{tenant_domain}/third-party/v1/whatsapp/campaigns/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{tenant_domain}/third-party/v1/whatsapp/campaigns/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'agent_id' => 123,
'template_name' => '<unknown>',
'template_language' => 'de',
'template_components' => [
[
]
],
'recipients' => [
[
'profile_id' => 123,
'name' => '<string>',
'phone_number' => 4915212345678,
'placeholders' => [
]
]
],
'start_at' => '2023-01-01T12:00:00Z',
'send_from' => '00:00:00',
'send_until' => '23:59:59',
'assign_bot_id' => 123,
'assign_user_id' => 123,
'assign_folder_id' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{tenant_domain}/third-party/v1/whatsapp/campaigns/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"agent_id\": 123,\n \"template_name\": \"<unknown>\",\n \"template_language\": \"de\",\n \"template_components\": [\n {}\n ],\n \"recipients\": [\n {\n \"profile_id\": 123,\n \"name\": \"<string>\",\n \"phone_number\": 4915212345678,\n \"placeholders\": {}\n }\n ],\n \"start_at\": \"2023-01-01T12:00:00Z\",\n \"send_from\": \"00:00:00\",\n \"send_until\": \"23:59:59\",\n \"assign_bot_id\": 123,\n \"assign_user_id\": 123,\n \"assign_folder_id\": 123\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://{tenant_domain}/third-party/v1/whatsapp/campaigns/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"agent_id\": 123,\n \"template_name\": \"<unknown>\",\n \"template_language\": \"de\",\n \"template_components\": [\n {}\n ],\n \"recipients\": [\n {\n \"profile_id\": 123,\n \"name\": \"<string>\",\n \"phone_number\": 4915212345678,\n \"placeholders\": {}\n }\n ],\n \"start_at\": \"2023-01-01T12:00:00Z\",\n \"send_from\": \"00:00:00\",\n \"send_until\": \"23:59:59\",\n \"assign_bot_id\": 123,\n \"assign_user_id\": 123,\n \"assign_folder_id\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant_domain}/third-party/v1/whatsapp/campaigns/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"agent_id\": 123,\n \"template_name\": \"<unknown>\",\n \"template_language\": \"de\",\n \"template_components\": [\n {}\n ],\n \"recipients\": [\n {\n \"profile_id\": 123,\n \"name\": \"<string>\",\n \"phone_number\": 4915212345678,\n \"placeholders\": {}\n }\n ],\n \"start_at\": \"2023-01-01T12:00:00Z\",\n \"send_from\": \"00:00:00\",\n \"send_until\": \"23:59:59\",\n \"assign_bot_id\": 123,\n \"assign_user_id\": 123,\n \"assign_folder_id\": 123\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": 123,
"name": "<string>",
"agent_id": "<string>",
"wa_template_id": "<string>",
"components": [
{}
],
"start_at": "2023-01-01T12:00:00Z",
"send_from": "00:00:00",
"send_until": "23:59:59",
"assign_bot_id": 123,
"assign_user_id": 123,
"assign_folder_id": 123,
"assign_tag_id": 123,
"assign_group_id": 123,
"resume_at": "2023-01-01T12:00:00Z",
"finished_at": "2023-01-01T12:00:00Z",
"created_at": "2023-01-01T12:00:00Z",
"updated_at": "2023-01-01T12:00:00Z",
"recipients_count": 123,
"latest_statistics": {
"id": 123,
"campaign_id": 123,
"datetime": "2023-01-01T12:00:00Z",
"recipients_count": 123,
"to_send_count": 123,
"to_send_percent": 123,
"sent_count": 123,
"sent_percent": 123,
"delivered_count": 123,
"delivered_percent": 123,
"read_count": 123,
"read_percent": 123,
"error_count": 123,
"error_percent": 123
}
}
}Update a campaign by ID. Only campaigns with status "draft" can be updated.
curl --request PUT \
--url https://{tenant_domain}/third-party/v1/whatsapp/campaigns/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"agent_id": 123,
"template_name": "<unknown>",
"template_language": "de",
"template_components": [
{}
],
"recipients": [
{
"profile_id": 123,
"name": "<string>",
"phone_number": 4915212345678,
"placeholders": {}
}
],
"start_at": "2023-01-01T12:00:00Z",
"send_from": "00:00:00",
"send_until": "23:59:59",
"assign_bot_id": 123,
"assign_user_id": 123,
"assign_folder_id": 123
}
'import requests
url = "https://{tenant_domain}/third-party/v1/whatsapp/campaigns/{id}"
payload = {
"name": "<string>",
"agent_id": 123,
"template_name": "<unknown>",
"template_language": "de",
"template_components": [{}],
"recipients": [
{
"profile_id": 123,
"name": "<string>",
"phone_number": 4915212345678,
"placeholders": {}
}
],
"start_at": "2023-01-01T12:00:00Z",
"send_from": "00:00:00",
"send_until": "23:59:59",
"assign_bot_id": 123,
"assign_user_id": 123,
"assign_folder_id": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
agent_id: 123,
template_name: '<unknown>',
template_language: 'de',
template_components: [{}],
recipients: [
{
profile_id: 123,
name: '<string>',
phone_number: 4915212345678,
placeholders: {}
}
],
start_at: '2023-01-01T12:00:00Z',
send_from: '00:00:00',
send_until: '23:59:59',
assign_bot_id: 123,
assign_user_id: 123,
assign_folder_id: 123
})
};
fetch('https://{tenant_domain}/third-party/v1/whatsapp/campaigns/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{tenant_domain}/third-party/v1/whatsapp/campaigns/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'agent_id' => 123,
'template_name' => '<unknown>',
'template_language' => 'de',
'template_components' => [
[
]
],
'recipients' => [
[
'profile_id' => 123,
'name' => '<string>',
'phone_number' => 4915212345678,
'placeholders' => [
]
]
],
'start_at' => '2023-01-01T12:00:00Z',
'send_from' => '00:00:00',
'send_until' => '23:59:59',
'assign_bot_id' => 123,
'assign_user_id' => 123,
'assign_folder_id' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{tenant_domain}/third-party/v1/whatsapp/campaigns/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"agent_id\": 123,\n \"template_name\": \"<unknown>\",\n \"template_language\": \"de\",\n \"template_components\": [\n {}\n ],\n \"recipients\": [\n {\n \"profile_id\": 123,\n \"name\": \"<string>\",\n \"phone_number\": 4915212345678,\n \"placeholders\": {}\n }\n ],\n \"start_at\": \"2023-01-01T12:00:00Z\",\n \"send_from\": \"00:00:00\",\n \"send_until\": \"23:59:59\",\n \"assign_bot_id\": 123,\n \"assign_user_id\": 123,\n \"assign_folder_id\": 123\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://{tenant_domain}/third-party/v1/whatsapp/campaigns/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"agent_id\": 123,\n \"template_name\": \"<unknown>\",\n \"template_language\": \"de\",\n \"template_components\": [\n {}\n ],\n \"recipients\": [\n {\n \"profile_id\": 123,\n \"name\": \"<string>\",\n \"phone_number\": 4915212345678,\n \"placeholders\": {}\n }\n ],\n \"start_at\": \"2023-01-01T12:00:00Z\",\n \"send_from\": \"00:00:00\",\n \"send_until\": \"23:59:59\",\n \"assign_bot_id\": 123,\n \"assign_user_id\": 123,\n \"assign_folder_id\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant_domain}/third-party/v1/whatsapp/campaigns/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"agent_id\": 123,\n \"template_name\": \"<unknown>\",\n \"template_language\": \"de\",\n \"template_components\": [\n {}\n ],\n \"recipients\": [\n {\n \"profile_id\": 123,\n \"name\": \"<string>\",\n \"phone_number\": 4915212345678,\n \"placeholders\": {}\n }\n ],\n \"start_at\": \"2023-01-01T12:00:00Z\",\n \"send_from\": \"00:00:00\",\n \"send_until\": \"23:59:59\",\n \"assign_bot_id\": 123,\n \"assign_user_id\": 123,\n \"assign_folder_id\": 123\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": 123,
"name": "<string>",
"agent_id": "<string>",
"wa_template_id": "<string>",
"components": [
{}
],
"start_at": "2023-01-01T12:00:00Z",
"send_from": "00:00:00",
"send_until": "23:59:59",
"assign_bot_id": 123,
"assign_user_id": 123,
"assign_folder_id": 123,
"assign_tag_id": 123,
"assign_group_id": 123,
"resume_at": "2023-01-01T12:00:00Z",
"finished_at": "2023-01-01T12:00:00Z",
"created_at": "2023-01-01T12:00:00Z",
"updated_at": "2023-01-01T12:00:00Z",
"recipients_count": 123,
"latest_statistics": {
"id": 123,
"campaign_id": 123,
"datetime": "2023-01-01T12:00:00Z",
"recipients_count": 123,
"to_send_count": 123,
"to_send_percent": 123,
"sent_count": 123,
"sent_percent": 123,
"delivered_count": 123,
"delivered_percent": 123,
"read_count": 123,
"read_percent": 123,
"error_count": 123,
"error_percent": 123
}
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
ID of WhatsApp agent to use for creating the campaign.
Name of template to send.
Language of template to send.
"de"
Array of objects describing how to fill variables within the specified template.
If there are no variables, set this to an empty array.
Format is defined by WhatsApp. See components under https://developers.facebook.com/docs/whatsapp/cloud-api/guides/send-message-templates
Show child attributes
Show child attributes
When to start the campaign in UTC. Only relevant when status is "in_progress". When messaging limit is hit for agent, campaign will pause automatically and resume the next day at the same time.
"2023-01-01T12:00:00Z"
Together with send_until: time window to send the campaign. Can be used such that customers do not receive messages in the middle of the night.
"00:00:00"
See send_from.
"23:59:59"
Optional ID of bot which will be assigned to the conversation. Existing running bot will be stopped and a new one will be started.
Optional ID of user the conversation will be assigned to.
Optional ID of folder the conversation will be assigned to.
Response
Success
WhatsApp campaign (marketing).
Show child attributes
Show child attributes